import app
import requests


class Emp:
    def __init__(self):
        self.add_url = app.BASE_USER + '/api/sys/user'
        self.modify_url = app.BASE_USER + '/api/sys/user/{}'
        self.get_url = app.BASE_USER + '/api/sys/user/{}'
        self.del_url = app.BASE_USER + '/api/sys/user/{}'

    def add_emp(self, add_data):
        return requests.post(url=self.add_url, json=add_data, headers=app.headers)

    def modify_emp(self, emp_id, json_data):
        url = self.modify_url.format(emp_id)
        return requests.put(url=url, json=json_data, headers=app.headers)

    def get_emp(self, emp_id):
        url = self.get_url.format(emp_id)
        return requests.get(url=url, headers=app.headers)

    def delete_emp(self, emp_id):
        url = self.del_url.format(emp_id)
        return requests.delete(url=url, headers=app.headers)
